<?php
session_start();

include("header.php");

if ($_GET['action'] == 'logout') {
			session_unset(); 
}
	if($_SESSION['zalogowany']) {
		header("Location: main.php");
	}
	
	include("config.php");
	include("class/logowanie.class.php");
	
	
	
	if ($_POST['action'] == 'Zaloguj') {	
		$user	 = $_POST["login"];
		$pass	= $_POST["haslo"]; 
		$signin = new Logowanie($user, $pass);
		//$logowanie = $signin->init();
	}	
	//echo $logowanie;
	
	
	
	
	//Formularz logowania
		echo '<form class="login" method="POST">';
			echo '<table>';
				echo '<tr>';
					echo '<td>Konto:</td>
						<td>
							<select name="kto">
								<option value="Admin">Administrator</option>
								<option value="Nauczyciel">Nauczyciel</option>
								<option value="Rodzic">Rodzic</option>
								<option value="Uczniowie">Uczeń</option>
							</select>
						</td>';
				echo '</tr>';
				echo '<tr>';
					echo '<td>Login:</td><td><input name=login></td>';
				echo '</tr>';
				echo '<tr>';
					echo '<td>Hasło:</td><td><input type=password name=haslo></td>';
				echo '</tr>';
				echo '<tr>';
				echo '<td align=center colspan="2"><input type=submit name="action" value=Zaloguj></td>';
				echo '</tr>';
				if ($error) {
					echo '<tr>';
						echo '<td align=center colspan="2">'.$error.'</td>';
					echo '</tr>';
				}
				
			echo '</table>';
		echo '</form>';

	include('footer.php');
?>